package com.sy.workflow.service.controllers;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.sy.core.bean.CommonResult;
import com.sy.core.enums.ResultCodeEnum;
import com.sy.core.exceptions.BusinessException;
import com.sy.workflow.core.dto.FlowUser;
import com.sy.workflow.service.service.WfUserApiService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

@Api(tags="测试API")
@RestController
@RequestMapping("test")
@Slf4j
public class TestController {
	
	@Resource
	WfUserApiService wfUserApiService;
 	
	 /**
   	 * @function 获取测试账号的登录信息
   	 * @author 肖荣辉
   	 * @date 2022-06-11 10:08:58
   	*/
   	@ApiOperation("测试")
   	@PostMapping("/test")
   	public  CommonResult<FlowUser> testGetFowUser(){
   		
   		try {
   			
   			return CommonResult.success(wfUserApiService.getFowUser("-1"));
   				
   		} catch (BusinessException e) {
   			return CommonResult.failed(e.getCode() , e.getMsg());
   		} catch (Exception e) {
   			log.error("testGetFowUser 发生错误 ==> " , e);
   			return CommonResult.failed(ResultCodeEnum.SYSTEM_FAILED);
   		}
   		
   	}
   	
   	
   	
}
